import Vue from 'vue';
import Router from 'vue-router';

import NotFound from './views/NotFound';
import Login from './views/login/Login';
import MainPage from './components/MainPage';

import Home from './views/Home';

import SystemRoleList from './views/system/SystemRoleList';
import SystemRoleEdit from './views/system/SystemRole';
import UserList from './views/user/UserList';

import RentListManage from './views/rent/RentList.manage';
import RentFlatsManage from './views/rent/RentFlats.manage';
import RentCommunityManage from './views/rent/RentCommunity.manage';

import OpticalBoxList from './views/opticalbox/OpticalBoxList';
import OpticalBoxMap from './views/opticalbox/OpticalBoxMap';

Vue.use(Router);

// @todo 建议采用 addRoutes
export default new Router({
	mode: 'hash',
	base: process.env.BASE_URL,
	routes: [
        { path: '', redirect: 'login' }, 
        { path: '/login', name: 'login', component: Login }, 
        { path: '/home', name: 'home', component: Home,
            children: [
                { path: '', name:'MainPage', component: MainPage },
                { path: 'sysRole', name: 'sysRole', component: SystemRoleList},
                { path: 'sysRoleEdit', name: 'sysRoleEdit', component: SystemRoleEdit},

                { path: 'userList', name: 'userList', component: UserList},
                
                { path: 'rentList', name: 'rentList', component: RentListManage},
                { path: 'rentFlats', name: 'rentFlats', component: RentFlatsManage},
                { path: 'rentCommunity', name: 'rentCommunity', component: RentCommunityManage},

                { path: 'opticalBoxList', name: 'opticalBoxList', component: OpticalBoxList},
                { path: 'opticalBoxMap', name: 'opticalBoxMap', component: OpticalBoxMap}
            ]
        },
        // 最后配置404
        {path: '*', name:'NotFound', component: NotFound}
    ]
})
